<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="zh-CN"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="zh-CN"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="zh-CN"> <![endif]-->
<!--[if gt IE 8]><!-->
<html lang="zh-CN"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title> CCRM 管理平台</title>
<link rel="shortcut icon" href="${gPath}/img/favicon.png" >
<style>
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}

body {
    line-height: 1;
}

ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

html {
    background: url('${gPath}/img/coffee_03.jpg') no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

body {
    font: 14px/20px 'Lucida Grande', Tahoma, '微软雅黑', Verdana, sans-serif;
    color: #404040
}

.container {
    margin: 200px auto 0;
    width: 640px;
}

.login {
    position: relative;
    margin: 0 auto;
    padding: 20px 20px 20px;
    width: 310px;
    background: white;
    border-radius: 3px;
    -webkit-box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
}

.login:before {
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    bottom: -8px;
    left: -8px;
    z-index: -1;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}

.login h1 {
    margin: -20px -20px 21px;
    line-height: 40px;
    font-size: 16px;
    color: #555;
    text-align: center;
    text-shadow: 0 1px white;
    background: #f3f3f3;
    border-bottom: 1px solid #cfcfcf;
    border-radius: 3px 3px 0 0;
    background-image: -webkit-linear-gradient(top, whiteffd, #eef2f5);
    background-image: -moz-linear-gradient(top, whiteffd, #eef2f5);
    background-image: -o-linear-gradient(top, whiteffd, #eef2f5);
    background-image: linear-gradient(to bottom, whiteffd, #eef2f5);
    -webkit-box-shadow: 0 1px whitesmoke;
    box-shadow: 0 1px whitesmoke;
}

.login p {
    margin: 20px 0 0;
}

.login p:first-child {
    margin-top: 0;
}

.login input[type=text], .login input[type=password] {
    width: 278px;
}

.login p.remember_me {
    float: left;
    line-height: 31px;
}

.login p.remember_me label {
    font-size: 12px;
    color: #777;
    cursor: pointer;
}

.login p.remember_me input {
    position: relative;
    bottom: 1px;
    margin-right: 4px;
    vertical-align: middle;
}

.login p.submit {
    text-align: right;
}

.login-help {
    margin: 20px 0;
    font-size: 12px;
    color: white;
    text-align: center;
    color: #DDD;
    text-shadow: 0 1px #4B7490;
}

.login-help a {
    color: #EFEFEF;
    text-decoration: none;
}

.login-help a:hover {
    text-decoration: underline;
}

input {
    font-family: 'Lucida Grande', Tahoma, Verdana, sans-serif;
    font-size: 14px;
}

input[type=text], input[type=password] {
    margin: 5px;
    padding: 0 10px;
    width: 200px;
    height: 34px;
    color: #404040;
    background: white;
    border: 1px solid;
    border-color: #c4c4c4 #d1d1d1 #d4d4d4;
    border-radius: 2px;
    outline: 5px solid #eff4f7;
    -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

input[type=text]:focus, input[type=password]:focus {
    border-color: #7dc9e2;
    outline-color: #dceefc;
    outline-offset: 0;
}

input[type=submit],input[type=button] {
    padding: 0 10px;
    height: 29px;
    font-size: 12px;
    font-weight: bold;
    color: #527881;
    text-shadow: 0 1px #e3f1f1;
    background: #cde5ef;
    border: 1px solid;
    border-color: #b4ccce #b3c0c8 #9eb9c2;
    border-radius: 16px;
    outline: 0;
    -webkit-box-sizing: content-box;
    -moz-box-sizing: content-box;
    box-sizing: content-box;
    background-image: -webkit-linear-gradient(top, #edf5f8, #cde5ef);
    background-image: -moz-linear-gradient(top, #edf5f8, #cde5ef);
    background-image: -o-linear-gradient(top, #edf5f8, #cde5ef);
    background-image: linear-gradient(to bottom, #edf5f8, #cde5ef);
    -webkit-box-shadow: inset 0 1px white, 0 1px 2px rgba(0, 0, 0, 0.15);
    box-shadow: inset 0 1px white, 0 1px 2px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

input[type=submit]:active,input[type=button]:active {
    background: #cde5ef;
    border-color: #9eb9c2 #b3c0c8 #b4ccce;
    -webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2);
}

.lt-ie9 input[type=text], .lt-ie9 input[type=password] {
    line-height: 34px;
}

.tips-warning {
    border: 1px solid #ffb2b2;
    background: #fff3f3;
    padding: 4px;
    border-radius: 3px;
    text-align: center
}
</style>
<link href="${gPath}/styles/bui-min.css" rel="stylesheet"/>
</head>
<body>
<section class="container">
    <div class="login">
        <h1>科贝尔客户管理平台</h1>
        <form method="post" action="${gPath}/res/_webApi/signin/loginOk">
            <p><input type="text" name="account" value="${param.account}" placeholder="登录帐号"></p>

            <p><input type="password" name="password" value="" placeholder="登录密码"></p>

            <j:if test="${not empty shiroLoginFailure}">
                <p class="tips-warning">
                    <j:switch value="${shiroLoginFailure}">
                        <j:case value="UNKA">
                            帐号或密码错误
                        </j:case>
                        <j:case value="DISA">
                            帐号已被冻结，请联系管理员
                        </j:case>
                        <j:default>
                            系统繁忙，请稍后再试或联系管理员
                        </j:default>
                    </j:switch>
                </p>
            </j:if>

            <p class="remember_me">
                <label>
                    欢迎使用科贝尔客户管理平台
                </label>
            </p>

            <p class="submit">
                <input type="button" id="qrCodeBtn" value="扫码登录">
                <input type="submit" name="commit" value="登录">
            </p>
        </form>
    </div>
    <div class="login-help">
        <p></p>
    </div>
    <!--二维码-->
    <div id="loginQrCodeDialog" style="display: none;">
    </div>
</section>

<script type="text/javascript" src="https://g.alicdn.com/dingding/dinglogin/0.0.2/ddLogin.js"></script>
<script type="text/javascript" src="${gPath}/scripts/jquery/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="${gPath}/scripts/bui.js"></script>
<script type="text/javascript">
    BUI.use(['bui/overlay'], function (Overlay) {
        var params = encodeURIComponent("appid=${appid}&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=${redirectUri}");
        var obj = DDLogin({
            id:"loginQrCodeDialog",//这里需要你在自己的页面定义一个HTML标签并设置id，例如<div id="login_container"></div>或<span id="login_container"></span>
            goto: "${qrCodeAuthorizeUrl}?"+ params,
            style: "",
            href: "",
            width : "300px",
            height: "300px"
        });

        var hanndleMessage = function (event) {
            var loginTmpCode = event.data; //拿到loginTmpCode后就可以在这里构造跳转链接进行跳转了
            window.location.href = "${qrCodeAuthorizeUrl}?appid=${appid}&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=${redirectUri}&loginTmpCode="+ loginTmpCode
        };
        if (typeof window.addEventListener != 'undefined') {
            window.addEventListener('message', hanndleMessage, false);
        } else if (typeof window.attachEvent != 'undefined') {
            window.attachEvent('onmessage', hanndleMessage);
        }

        $("#qrCodeBtn").click(function(){
            loginQrCodeDialog.show();
        });
        var loginQrCodeDialog = new Overlay.Dialog({
            title: '扫码登录',
            width: 400,
            height: 410,
            mask: true,
            buttons: [],
            contentId: 'loginQrCodeDialog'
        });
    });
</script>
</body>
</html>
